 package com.zx.cloud.controller.client;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.common.auth0.jwt.Token;
import com.zx.cloud.common.auth0.jwt.exceptions.JWTCreationException;
import com.zx.cloud.domain.Client;
import com.zx.cloud.domain.Resource;
import com.zx.cloud.domain.User;
import com.zx.cloud.model.request.ManagerLoginRequest;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.model.response.Response;
import com.zx.cloud.util.Page;

import feign.Headers;

/**
 * @author Alex
 */
@FeignClient(name = ProviderClient.SERVICE_ID, fallback = ProviderClientFallback.class)
public interface ProviderClient {
	
    /**
     * eureka service name
     */
    String SERVICE_ID = "trade-provider";
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value =ApiVersion.PROVIDER_V1_PREFIX+"/user/find", method = RequestMethod.GET)
    ObjectDataResponse<Page<Object>> findUser();
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value =ApiVersion.PROVIDER_V1_PREFIX+"/user/find2", method = RequestMethod.GET)
    ObjectDataResponse<Page<Object>> findUser2(User user);

    @Headers("X-Auth-Token:{X-Auth-Token},Cookie:{Cookie}")
   	@RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/demo/test", method = RequestMethod.POST)
    ObjectDataResponse<ManagerLoginRequest> demoTest(ManagerLoginRequest loginRequest);
    
    @Headers("X-Auth-Token:{X-Auth-Token},Cookie:{Cookie}")
   	@RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/demo/test2", method = RequestMethod.POST)
    ObjectDataResponse<ManagerLoginRequest> demoTest2(ManagerLoginRequest loginRequest);
    
    
    @Headers("X-Auth-Token:{X-Auth-Token},Cookie:{Cookie}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/demo/test2", method = RequestMethod.POST)
    ObjectDataResponse<ManagerLoginRequest> demoTest3();
    
    @Headers("X-Auth-Token:{X-Auth-Token},Cookie:{Cookie}")
   	@RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/demo/loginTest", method = RequestMethod.POST)
    ObjectDataResponse<Token> loginTest(ManagerLoginRequest loginRequest);
    
    //测试查询查询会员信息
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/client/queryClient", method = RequestMethod.POST)
    ObjectDataResponse<Page<Client>> queryClient(Client client);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/getUserList", method = RequestMethod.POST)
	ObjectDataResponse<Page<Object>> page(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/addUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> insert(User user);
   
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/updateUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> updateUser(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/deleteUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> deleteUser(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/banUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> banUser(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/startUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> startUser(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/getUser", method = RequestMethod.POST)
	ObjectDataResponse<Object> getUser(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/accountQuery", method = RequestMethod.POST)
	ObjectDataResponse<Object> accountQuery(User user);
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/login", method = RequestMethod.POST)
	ObjectDataResponse<Page<Object>> login();
    
    @Headers("X-Auth-Token:{X-Auth-Token}")
    @RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/user/resetPassword", method = RequestMethod.POST)
	ObjectDataResponse<Object> resetPassword(User user);
    
}
